import glumpy
from gl_shapes import *

# fig is the window to which you will draw.
# you need to tell glumpy how big you want the window.
# in this case the window is 512 pixels in the x direction by 512 pixels in the y direction
# the origin of the window (0,0) is at the top left
fig = glumpy.figure( (800,600) )
smooth()

def on_draw():
	# fig.clear() tells glumpy to give the "canvas" in the window a background color
	# fig.clear()
	# if you want a different color background you can specify this with a series of numbers like the line below




	red = 165/255.0
	green=109/255.0
	blue= 35/255.0
	alpha=1.0
	fig.clear(red,green,blue,alpha)
	# this line would give us a green background
	# the numbers correspond to (red, green, blue, alpha) alpha is the transparency
	# these numbers need to be between 0.0 and 1.0

	# now let's draw some shapes!
	# starting with a rectangle
	# rectangle((x,y), width, height, rotation in degrees, color=(r,g,b,a))
	moritz_color_one = 1.0,1.0,1.0,0.5
	moritz_color_two = 0.0,0.0,0.1,0.5

	rectangle((200,200), 100, 100, 45.0, moritz_color_one)
	rectangle((200,200), 20, 500, 25.0, moritz_color_one)
	rectangle((400,30), 30, 20, -145.0, moritz_color_two)
	# now let's draw a circle on top of the square
	ellipse(c=(200.0,200.0),h=40.0, w=80.0, a=0.0, color=(1.0,1,0,0.75), step=20, stroke=1.0, type="fill")

	# now let's draw a single line
	point1 = (0,0)
	point2 = (40,300)
	point3 = (800,800)
	centerpoint = (400,400)
	points = point1,centerpoint,point2
	polyline(points, color=(1.0,1.0,0.9,.5), stroke=1.0,type="filled")

fig.window.push_handlers(on_draw)
glumpy.show()